// src/utils/draggable.js

export function draggable(el) {
    let isResizing = false;
    let startWidth;
    let startX;
    const handleMouseDown = (event) => {
        isResizing = true;
        startWidth = el.offsetWidth;
        startX = event.clientX;
        document.addEventListener('mousemove', handleMouseMove);
        document.addEventListener('mouseup', handleMouseUp);
    };
    const handleMouseMove = (event) => {
        if (isResizing) {
            const dx = event.clientX - startX;
            el.style.width = `${startWidth + dx}px`;
        }
    };
    const handleMouseUp = () => {
        isResizing = false;
        document.removeEventListener('mousemove', handleMouseMove);
        document.removeEventListener('mouseup', handleMouseUp);
    };
    el.addEventListener('mousedown', handleMouseDown);
}




